//
//  PersonFactory.m
//  工厂模式
//
//  Created by Song on 2018/5/18.
//  Copyright © 2018年 Song. All rights reserved.
//

#import "PersonFactory.h"
#import "Person.h"
#import "Teacher.h"
#import "Student.h"

NSString *TeacherClassName = @"Teacher";
NSString *StudentClassName = @"Student";

@implementation PersonFactory

-(void)creatObject:(NSString *)className complete:(void (^)(Person *))callBlock {
    if ([className isEqualToString:NSStringFromClass([Teacher class])]) {
        Teacher *teacher = [[Teacher alloc] init];
        callBlock(teacher);
        [teacher teachStudent];
    }
    if ([className isEqualToString:NSStringFromClass([Student class])]) {
        Student *student = [[Student alloc] init];
        callBlock(student);
        [student learnKnowledge];
    }
}


@end
